package com.hotleproject.service.impl;

import com.hotleproject.mapper.CommentMapper;
import com.hotleproject.pojo.Comment;
import com.hotleproject.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;
    @Override
    public void addComment(Comment comment) {
        this.commentMapper.insertComment(comment);
    }

    @Override
    public int getCommentCount() {
        return this.commentMapper.getCommentCount();
    }

    @Override
    public List<Comment> findHotleComment(String hotlename) {
        return this.commentMapper.selectHotleComment(hotlename);
    }

    @Override
    public int getUserCommentCount() {
        return this.commentMapper.getUserCommentCount();
    }

    @Override
    public List<Comment> selectUserComment(String username,int tempPageNo,int pageSize) {
        return this.commentMapper.selectUserComment(username,tempPageNo,pageSize);
    }

    @Override
    public void deleteComment(String username, String commentDate) {
        this.commentMapper.deleteComment(username,commentDate);
    }
}
